<?php
if(count($_POST)>0)
{
 $name=$_POST['name'];
 $email=$_POST['email'];
 
 $random_salt = hash('sha512', uniqid(mt_rand(1, mt_getrandmax()), true));
    // Create salted password (Careful not to over season)
 $pass=$_POST['pass'];
    $password = hash('sha512', $pass.$random_salt);

 $sql="insert into user(name,email,pass) values ('$name','$email','$password')";
// echo "$sql";
 mysqli_query($conn, $sql);
 writeLog($conn, $idUser, "User add by admin");
 header('location:?mod=user');
} 

?>
<form name="form1" method="post" action="">
  <table width="800" border="1" style="width:400px;margin:auto">
    <caption>
      ADD New User
    </caption>
    <a href="?mod=user">Back to Usermanager</a>
    <tr>
      <th width="334" scope="row">Name</th>
      <td width="450"><label>
        <input name="name" type="text" id="name" size="40">
      </label></td>
    </tr>

    <tr>
      <th width="334" scope="row">Email</th>
      <td width="450"><label>
        <input name="email" type="text" id="email" size="40">
      </label></td>
    </tr>

    <tr>
      <th width="334" scope="row">Password</th>
      <td width="450"><label>
        <input name="pass" type="text" id="pass" size="40">
      </label></td>
    </tr>

    <th scope="row">&nbsp;</th>
    <td><label>
      <input type="reset" name="reset" id="submit" value="Nhập lại">
      <input type="submit" name="submit" id="submit" value="Thêm">
    </label></td>
  </tr>
</table>
</form>
